<?php
namespace Data;

use Data\Drive\ToQuerySql;
use PDO;

class Detail extends \Data
{
    public static function Run($sql)
    {
        is_array($sql) && $sql = ToQuerySql::Run($sql);
        $data                  = self::$db->query($sql);
        $code                  = self::$db->errorCode();
        if ($code != 00000) {
            $info = self::$db->errorInfo();
            self::Error(json_encode($info) . "\r\n" . $sql, __FILE__, __LINE__);
        } else if (!$data || $data->rowCount() == 0) {
            return null;
        }
        return $data->fetch(PDO::FETCH_ASSOC);
    }
}
